<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
	  <home></home>
	  <hr>
	  <news></news>
  </div>
  <template id="Home">
	  <div>
		  Home组件
		  <common-head :title="msg"></common-head>
	  </div>
  </template>
  <template id="news">
  	  <div>
  		  news组件
		  <common-head></common-head>
  	  </div>
  </template>
  <script src="./vue.js"></script>
  <script>
	  // 头部组件
	 const CommonHead = {
		props:['title'],    // properties
		template:`
			<div>
				我是头部组件
				<h2> {{title}} </h2>
			</div>
		`,
		data () {
			return {
				msg: 'hello'
			}
		}
	 }
    const Home = {
      template: '#Home',
	  components: {
		  CommonHead
	  },
	  data () {
		  return {
			  msg: '我是home组件中data中的数据'
		  }
	  }
    }
	const News = {
	  template: '#news',
	  components: {
		  CommonHead
	  }
	}
	Vue.component('Home',Home)
	Vue.component('news',News)
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>